<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      :data="monthlist"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row
    >
      <el-table-column
          type="index"
          label="序号"
          align="center"
          width="50">
      </el-table-column>
      <el-table-column
          prop="statsTime"
          label="时间"
          :formatter="getStatsTime"
          align="center">
      </el-table-column>
      <el-table-column
          prop="payAmount"
          label="交易金额"
          align="center">
      </el-table-column>
      <el-table-column
          prop="payCount"
          label="交易笔数"
          align="center">
      </el-table-column>
      <el-table-column
          prop="income"
          label="分润金额"
          align="center">
      </el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="params.current" :limit.sync="params.size" @pagination="getMonthlist" />
  </div>
</template>

<script>
import { monthStat } from "@/api/api.verify.js"
import Pagination from '@/components/Pagination'
export default {
  components:{Pagination},
  name: 'GatherMonth',
  data() {
    return {
      btnPower:JSON.parse(localStorage.getItem('btnList')),//按钮权限
      listLoading: true,
      total:0,//总条数
      monthlist:[],//代理商月汇总列表
      params:{
        current: 1,
        size: 10,
      },//查询条件
    }
  },
  created() {
    this.getStart()
  },
  methods: {
    getStart(){
      this.getMonthlist()
    },
    getMonthlist(){//获取代理商月汇总列表
      let _this=this;
      let data=this.params;
      this.listLoading = true
      monthStat(data).then(d=>{
        _this.monthlist=d.data.list.records
        _this.total=Number(d.data.list.total)
      }).finally(d=>{
        _this.listLoading = false
      })
    },
    getSearch(){//查询
      this.params.current=1
      this.getMonthlist()
    },
    getStatsTime(row, column, cellValue, index){
      return this.common.getLocalTime(Number(cellValue)*1000,2)
    }
  },
  watch:{
  }
}
</script>
